//
//  NSString+appendPath.m
//  SinaWeibo
//
//  Created by Apple on 16/8/13.
//  Copyright © 2016年 Apple. All rights reserved.
//

#import "NSString+appendPath.h"

@implementation NSString (appendPath)


-(NSString *)appendToDocument{
    
    return [self appendPath:NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES).lastObject];
    
}

-(NSString *)appendToCaches{
    
    return [self appendPath:NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES).lastObject];
    
}

-(NSString *)appendToTemp{
    
    return [self appendPath:NSTemporaryDirectory()];
    
}





/**
 *  将文件名拼接到指定文件路径
 *
 *  @param path 指定文件路径
 *
 *  @return 返回拼接好的路径
 */
-(NSString *)appendPath:(NSString *)path{
    
    return [path stringByAppendingPathComponent:self];
    
}


@end
